package cn.yuanqiao.archive.utils.impl;

import cn.yuanqiao.archive.appManager.service.ITenantSysConfigService;
import cn.yuanqiao.archive.utils.FilePageCounter;
import cn.yuanqiao.archive.utils.OfdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.InputStream;
import java.util.List;

@Service("OfdFilePageCounter")
public class OfdFilePageCounter implements FilePageCounter {

    @Autowired
    private ITenantSysConfigService sysConfigService;

    @Override
    public int getPageCount(String filePath) throws Exception {
        //OfdUtil.zipOutPath = sysConfigService.selectConfigByKey("ZIP_OUT_PATH");
        return OfdUtil.getOfdPage(filePath);
    }

    @Override
    public InputStream extractPages(String url, List<Integer> pageNumbers) throws Exception {
        //OfdUtil.zipOutPath = sysConfigService.selectConfigByKey("ZIP_OUT_PATH");
        return OfdUtil.extractPages(pageNumbers,url);
    }
}
